﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using umbraco.presentation.templateControls;

namespace uHelpsy.Core
{
    public class UmbracoXsltHelper
    {

        /// <summary>
        /// Renders a macro which is in a WYSIWYG
        /// 
        /// Ie. Takes care of rendering this:
        /// <umbraco:Macro Alias="" macroAlias=""myAlias"" runat=""server""></umbraco:Macro>
        /// 
        /// </summary>
        /// <param name="field"></param>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public static string RenderMacroContent(int nodeId, string field)
        {
            Item item = new Item();
            item.Field = field;
            item.NodeId = nodeId.ToString();

            string s = umbraco.library.RenderMacroContent((string)item.PageElements[field], nodeId);
            return s;
        }

    }
}
